import {
	request,
} from '@/api/request';
const apiList = [{
		// /api/boss/loan
		name: 'loan',
		url: '/api/boss/loan',
		method:'GET'
	},
	{
		// /api/boss/order
		name: 'order',
		url: '/api/boss/order',
		method:'GET'
	},
	{
		// /api/boss/editLoan
		name: 'editLoan',
		url: '/api/boss/editLoan',
	},
	{
		// /api/boss/editOrder
		name: 'editOrder',
		url: '/api/boss/editOrder',
	},
	{
		// /api/boss/orderInfo
		name: 'orderInfo',
		url: '/api/boss/orderInfo'
	},
	{
		// /api/boss/createNotLoan
		name: 'createNotLoan',
		url: '/api/boss/createNotLoan'
	},
	{
		// /api/sale/loanInfo?id=1
		name: 'loanInfo',
		url: '/api/sale/loanInfo',
		method:'GET'
	},
	{
		// /api/sale/chartMoney
		name: 'chartMoney',
		url: '/api/sale/chartMoney',
		method:'GET'
	},
	{
		// /api/sale/createCredit
		name: 'createCredit',
		url: '/api/sale/createCredit',
	},
	{
		// /api/boss/order
		name: 'order',
		url: '/api/boss/order',
		method:'GET'
	},
	{
		// /api/boss/orderInfo
		name: 'orderInfo',
		url: '/api/boss/orderInfo',
		method:'GET'
	},
	{
		// /api/boss/editOrder
		name: 'editOrder',
		url: '/api/boss/editOrder'
	},
]


module.exports = apiList.reduce((mode, params) => {
	mode[params.name] = (data, token) => request({
		url: params.url,
		method: params.method || 'POST',
		data,
		token
	})
	return mode
}, {})